import React from 'react';
import type { FC } from 'react';
import styles from './style.less';

type operatorItem = {
  onClick: () => void;
  label: string;
  filter?: () => boolean;
};
type Props = {
  operatorList: operatorItem[];
};
const OperatorRender: FC<Props> = ({ operatorList }) => {
  return (
    <div className={styles.columnOperator}>
      {operatorList.map((item) => {
        const { filter, label, onClick } = item;
        if (!filter || filter()) {
          return (
            <a key={label} onClick={onClick}>
              {label}
            </a>
          );
        }
        return '';
      })}
    </div>
  );
};
export default OperatorRender;
